<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:swes="http://www.opengis.net/swes/2.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:om="http://www.opengis.net/om/2.0" targetNamespace="http://www.opengis.net/swes/2.0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0.0">
  <annotation>
    <documentation>
      SWES is an OGC Standard.
      Copyright (c) 2010, 2011 Open Geospatial Consortium, Inc. All Rights Reserved. 
      To obtain additional rights of use, visit http://www.opengeospatial.org/legal/ .
    </documentation>
  </annotation>
  <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="../../gml/3.2.1/gml.xsd"/>
  <import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
  <import namespace="http://docs.oasis-open.org/wsn/t-1" schemaLocation="http://docs.oasis-open.org/wsn/t-1.xsd"/>
  <import namespace="http://www.opengis.net/ows/1.1" schemaLocation="../../ows/1.1.0/owsAll.xsd"/>
  <include schemaLocation="swes.xsd"/>
  <include schemaLocation="swesCommon.xsd"/>
  <!-- ================================================= -->
  <element name="NotificationProducerMetadata" type="swes:NotificationProducerMetadataType" substitutionGroup="swes:AbstractSWES">
    <annotation>
      <documentation>provides information for clients to subscribe for notifications</documentation>
    </annotation>
  </element>
  <complexType name="NotificationProducerMetadataType">
    <complexContent>
      <extension base="swes:AbstractSWESType">
        <sequence>
          <element name="producerEndpoint">
            <annotation>
              <documentation>endpoint of the web service implementing the NotificationProducer interface defined by WS-BaseNotification; can but does not need to be the endpoint of the service which provided metadata</documentation>
            </annotation>
            <complexType>
              <sequence>
                <element ref="wsa:EndpointReference"/>
              </sequence>
            </complexType>
          </element>
          <element name="supportedDialects">
            <annotation>
              <documentation>the filter dialects (used in WS-Notification Subscribe requests) supported by the service</documentation>
            </annotation>
            <complexType>
              <sequence>
                <element ref="swes:FilterDialectMetadata"/>
              </sequence>
            </complexType>
          </element>
          <element name="fixedTopicSet" type="boolean">
            <annotation>
              <documentation>indicates if the set of served topics is static throughout the lifetime of the service instance</documentation>
            </annotation>
          </element>
          <element name="servedTopics">
            <annotation>
              <documentation>collection of topics supported by the service may change if the topic set is not fixed</documentation>
            </annotation>
            <complexType>
              <sequence>
                <element ref="wstop:TopicSet"/>
              </sequence>
            </complexType>
          </element>
          <element name="usedTopicNamespace" type="wstop:TopicNamespaceType" minOccurs="0" maxOccurs="unbounded">
            <annotation>
              <documentation>definition of a topic namespace used in the topic set of the service</documentation>
            </annotation>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <complexType name="NotificationProducerMetadataPropertyType">
    <sequence minOccurs="0">
      <element ref="swes:NotificationProducerMetadata"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
  </complexType>
  <!-- ================================================= -->
  <element name="NotificationBrokerMetadata" type="swes:NotificationBrokerMetadataType" substitutionGroup="swes:NotificationProducerMetadata">
    <annotation>
      <documentation>provides information for clients to subscribe for notifications from the service and to register for publishing notifications to the service</documentation>
    </annotation>
  </element>
  <complexType name="NotificationBrokerMetadataType">
    <complexContent>
      <extension base="swes:NotificationProducerMetadataType">
        <sequence>
          <element name="requiresRegistration" type="boolean">
            <annotation>
              <documentation>defines if a new publisher needs to be registered at the broker before it is allowed to send notifications</documentation>
            </annotation>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <complexType name="NotificationBrokerMetadataPropertyType">
    <sequence minOccurs="0">
      <element ref="swes:NotificationBrokerMetadata"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
  </complexType>
  <!-- ================================================= -->
  <element name="SWESEvent" type="swes:SWESEventType" substitutionGroup="swes:AbstractSWES">
    <annotation>
      <documentation>base class for encoding a SWE service event</documentation>
    </annotation>
  </element>
  <complexType name="SWESEventType">
    <complexContent>
      <extension base="swes:AbstractSWESType">
        <sequence>
          <element name="eventTime" type="dateTime">
            <annotation>
              <documentation>point in time the event happened</documentation>
            </annotation>
          </element>
          <element name="code" type="swes:EventCodeType">
            <annotation>
              <documentation>signifies the event</documentation>
            </annotation>
          </element>
          <element name="message" type="ows:LanguageStringType" minOccurs="0" maxOccurs="unbounded">
            <annotation>
              <documentation>human readable message in specific language describing the event</documentation>
            </annotation>
          </element>
          <element name="service">
            <annotation>
              <documentation>references the service where the event happened</documentation>
            </annotation>
            <complexType>
              <sequence>
                <element ref="wsa:EndpointReference"/>
              </sequence>
            </complexType>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <complexType name="SWESEventPropertyType">
    <sequence minOccurs="0">
      <element ref="swes:SWESEvent"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
  </complexType>
  <!-- ================================================= -->
  <element name="SensorChanged" type="swes:SensorChangedType" substitutionGroup="swes:SWESEvent">
    <annotation>
      <documentation>encodes the event of a change to one of the sensors hosted by the service</documentation>
    </annotation>
  </element>
  <complexType name="SensorChangedType">
    <complexContent>
      <extension base="swes:SWESEventType">
        <sequence>
          <element name="procedure" type="anyURI">
            <annotation>
              <appinfo>
                <gml:targetElement>unknown</gml:targetElement>
              </appinfo>
              <documentation>Pointer to the procedure that changed.</documentation>
            </annotation>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <complexType name="SensorChangedPropertyType">
    <sequence minOccurs="0">
      <element ref="swes:SensorChanged"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
  </complexType>
  <!-- ================================================= -->
  <element name="FilterDialectMetadata" type="swes:FilterDialectMetadataType" substitutionGroup="swes:AbstractSWES">
    <annotation>
      <documentation>lists filter dialects supported by the service</documentation>
    </annotation>
  </element>
  <complexType name="FilterDialectMetadataType">
    <complexContent>
      <extension base="swes:AbstractSWESType">
        <sequence>
          <element name="topicExpressionDialect" type="anyURI" minOccurs="0" maxOccurs="unbounded">
            <annotation>
              <appinfo>
                <gml:targetElement>swes:DialectCode</gml:targetElement>
              </appinfo>
              <documentation>identifier of supported topic expression language</documentation>
            </annotation>
          </element>
          <element name="messageContentDialect" type="anyURI" minOccurs="0" maxOccurs="unbounded">
            <annotation>
              <appinfo>
                <gml:targetElement>swes:DialectCode</gml:targetElement>
              </appinfo>
              <documentation>identifier of supported message content filter language</documentation>
            </annotation>
          </element>
          <element name="producerPropertiesDialect" type="anyURI" minOccurs="0" maxOccurs="unbounded">
            <annotation>
              <appinfo>
                <gml:targetElement>swes:DialectCode</gml:targetElement>
              </appinfo>
              <documentation>identifier of supported producer properties filter language</documentation>
            </annotation>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <complexType name="FilterDialectMetadataPropertyType">
    <sequence minOccurs="0">
      <element ref="swes:FilterDialectMetadata"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
  </complexType>
  <!-- ================================================= -->
  <element name="OfferingChanged" type="swes:OfferingChangedType" substitutionGroup="swes:SWESEvent">
    <annotation>
      <documentation>encodes the event of a change to one of the offerings hosted by the service</documentation>
    </annotation>
  </element>
  <complexType name="OfferingChangedType">
    <complexContent>
      <extension base="swes:SWESEventType">
        <sequence>
          <element name="offering" type="anyURI">
            <annotation>
              <appinfo>
                <gml:targetElement>swes:AbstractOffering</gml:targetElement>
              </appinfo>
              <documentation>Pointer to the offering that changed.</documentation>
            </annotation>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <complexType name="OfferingChangedPropertyType">
    <sequence minOccurs="0">
      <element ref="swes:OfferingChanged"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
  </complexType>
  <!-- ================================================= -->
  <element name="SensorDescriptionUpdated" type="swes:SensorDescriptionUpdatedType" substitutionGroup="swes:SensorChanged">
    <annotation>
      <documentation>encodes the event of an update to the description of one of the sensors hosted by the service</documentation>
    </annotation>
  </element>
  <complexType name="SensorDescriptionUpdatedType">
    <complexContent>
      <extension base="swes:SensorChangedType">
        <sequence>
          <element name="validTime" minOccurs="0">
            <annotation>
              <documentation>time instance or time interval for which the updated sensor description is valid</documentation>
            </annotation>
            <complexType>
              <sequence>
                <element ref="gml:AbstractTimeGeometricPrimitive"/>
              </sequence>
            </complexType>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <complexType name="SensorDescriptionUpdatedPropertyType">
    <sequence minOccurs="0">
      <element ref="swes:SensorDescriptionUpdated"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
  </complexType>
  <!-- ================================================= -->
  <simpleType name="EventCodeType">
    <union memberTypes="swes:EventCodeEnumerationType swes:EventCodeOtherType"/>
  </simpleType>
  <simpleType name="EventCodeEnumerationType">
    <restriction base="string">
      <enumeration value="CapabilitiesChanged">
        <annotation>
          <documentation>A property inside the service&amp;rsquo;s Capabilities document was added, removed or changed its value. If multiple changes happen at the same time (or in a time interval sufficiently small for a service to recognize them as belonging together) then they constitute one capabilities changed event.</documentation>
        </annotation>
      </enumeration>
      <enumeration value="OfferingAdded">
        <annotation>
          <documentation>A new offering - as defined by the SWE Service Model - was added to the service.</documentation>
        </annotation>
      </enumeration>
      <enumeration value="OfferingDeleted">
        <annotation>
          <documentation>An offering- as defined by the SWE Service Model - was deleted from the service.</documentation>
        </annotation>
      </enumeration>
      <enumeration value="SensorDescriptionUpdated">
        <annotation>
          <documentation>The description of a sensor was updated, meaning that information contained in the current and / or previous versions of the sensor's description was added, removed or modified.</documentation>
        </annotation>
      </enumeration>
      <enumeration value="SensorInserted">
        <annotation>
          <documentation>A sensor was inserted at the service, resulting in a new offering - as defined by the SWE Service Model - having been added to the service.</documentation>
        </annotation>
      </enumeration>
    </restriction>
  </simpleType>
  <simpleType name="EventCodeOtherType">
    <restriction base="string">
      <pattern value="other: [A-Za-z0-9_]{2,}"/>
    </restriction>
  </simpleType>
</schema>
